#!/bin/csh -f
# SVN: $Id$

if ( $#argv < 1 ) then
    echo "Usage: $0 [-r <revision>] <file> "
    exit 1
endif

if ( "$1" == "-r" ) then
    shift
    set rev="-r $1"
    shift
else
    set rev=""
endif

set diffinp=$1

if ( ! -d CVS ) then
    set arg=--diff-cmd='tkdiff'
    svn diff $rev $arg $diffinp
    exit 0
else
    set reposfile=./CVS/Repository
    if ( ! -e $reposfile ) then
	set filedir=`echo $1 | sed 's/\/.*$//'`
	cd $filedir
	set diffinp=`echo $diffinp|sed "s/$filedir\///"`
    endif

    set repos=`cat $reposfile`
    dvs co -p ${rev} $repos/$diffinp > /tmp/mdiff.$$

    tkdiff /tmp/mdiff.$$ $diffinp
    \rm /tmp/mdiff.$$
endif

